chore: replace legacy pan handler with new Gesture API in audio seekbar#6884
chore: replace legacy pan handler with new Gesture API in audio seekbar#6884divyanshu-patil wants to merge 3 commits intoRocketChat:developfrom
Conversation
WalkthroughThe Seek component's pan gesture handler is migrated from Changes
Poem
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/containers/AudioPlayer/Seek.tsx (1)
67-82: Clean migration to the new Gesture API.The implementation correctly uses
Gesture.Pan()with shared values instead of the legacy context pattern. A few minor observations:
onBeginvsonStart: UsingonBeginis appropriate here since you want to capture the initial position immediately when the user touches, not after exceeding the (very small)activeOffsetXthreshold.Optional optimization:
scale.value = 1.3is set on every update frame. You could move it toonBeginfor a minor performance improvement:🔎 Optional: Set scale once in onBegin
.onBegin(() => { isPanning.value = true; panOffsetX.value = translateX.value; + scale.value = 1.3; }) .onUpdate(({ translationX }) => { translateX.value = clamp(panOffsetX.value + translationX, 0, maxWidth.value); - scale.value = 1.3; })
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
app/containers/message/__snapshots__/Message.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (1)
app/containers/AudioPlayer/Seek.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
app/containers/AudioPlayer/Seek.tsx (1)
app/containers/AudioPlayer/constants.ts (2)
ACTIVE_OFFSET_X(13-13)SEEK_HIT_SLOP(5-5)
🔇 Additional comments (3)
app/containers/AudioPlayer/Seek.tsx (3)
3-3: LGTM!Correct imports for the new Gesture API from react-native-gesture-handler.
52-52: LGTM!Using a shared value to track the base offset at pan start is the correct pattern for the new Gesture API, replacing the implicit context from the legacy
useAnimatedGestureHandler.
122-124: LGTM!The
GestureDetectorwrapper is correctly applied, andhitSlopon the childAnimated.Viewproperly extends the touch target area for the thumb.
|
Duplicate of #6772 |
|
closing this as duplicate of #6772 |
Proposed changes
This PR migrates the audio seekbar pan gesture from the legacy
useAnimatedGestureHandlerAPI to the new Gesture Builder API provided byreact-native-gesture-handlerThe refactor removes the deprecated context-based gesture handler and replaces it with a modern, composable
Gesture.Pan()implementation while preserving existing behavior and UX.No visual or functional changes are intended.
Key improvements:
FIles Changed
app/containers/AudioPlayer/Seek.tsxIssue(s)
How to test or reproduce
Screenshots
Types of changes
Checklist
Further comments
This pr does not introduces any visual or functional changes
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.